<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
<title>打印页</title>
<meta charset="utf-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="static/lib/jquery/1.9.1/jquery-1.9.1.min.js"
	type="text/javascript"></script>
<link href="static/lib/bootstrap/3.0.2/css/bootstrap.min.css"
	type="text/css" rel="stylesheet" />
<link href="static/lib/bootstrap/3.0.2/css/bootstrap-theme.css"
	type="text/css" rel="stylesheet" />
<script src="static/lib/bootstrap/3.0.2/js/bootstrap.min.js"
	type="text/javascript"></script>
<link href="static/css/layout.css" type="text/css" rel="stylesheet" />
 <script type="text/javascript">			
						 $(document).ready(function (){
							  var http_request = false;
					        function createXmlRequest() {
						       if (window.ActiveXObject) { // IE浏览器
							try {
								http_request = new ActiveXObject("Msxml2.XMLHTTP");
							}                           
							catch (e) {
								try {
									http_request = new ActiveXObject("Microsoft.XMLHTTP");
								}
								catch (e) {
								}
							}
						} else {
							if (window.XMLHttpRequest) { //Mozilla 浏览器
								http_request = new XMLHttpRequest();
								if (http_request.overrideMimeType) {//设置MiME类别
									http_request.overrideMimeType("text/xml");
								}
							}
						}
					}          
						

					});
						 
						  function doPrint(){
					          bdhtml=window.document.body.innerHTML;    
					          sprnstr="<!--startprint-->";    
					          eprnstr="<!--endprint-->";    
					          prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);    
					          prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));    
					          window.document.body.innerHTML=prnhtml;   
					          window.print();
					          setTimeout('window.close()', 5000);
					    }
</script>
</head>
<body>
<!--startprint-->
	<div style="background: #FFF; width: 100%">
		<div>
			<h3 class="center">自营结算单</h3>
			<table class="table o-l-table table-bordered" id="table1" style="font-size: 13.5px">
				<tbody>
					<tr>
						<td class="text-left" style="width: 20%">结算单号:</td>
						<td style="width: 30%">${stmPrepaid.billNo}</td>
					    <td class="text-left" style="width: 20%">公司名称:</td>
						<td style="width: 30%">${stmPrepaid.companyName}</td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">供应商编码:</td>
						<td style="width: 30%">${stmPrepaid.supplierNo}</td>
						<td class="text-left" style="width: 20%">供应商合同号:</td>
						<td style="width: 30%">${stmPrepaid.contractNumber}</td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">结算期间:</td>
						<td style="width: 30%"><fmt:formatDate
								value="${stmPrepaid.startTime}" pattern="yyyy-MM-dd" />&nbsp;&nbsp;至&nbsp;&nbsp;<fmt:formatDate
								value="${stmPrepaid.endTime}" pattern="yyyy-MM-dd" /></td>

						<td class="text-left" style="width: 20%">供应商名称:</td>
						<td style="width: 30%">${stmPrepaid.supplierName}</td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">本期入库金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.purchaseAmount}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>

						<td class="text-left" style="width: 20%">本期退货金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.returnAmount}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">本期调价金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.priceAdjustment}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>

						<td class="text-left" style="width: 20%">本期返利金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.bebate}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">本期折扣分摊:</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.discountAllocation}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>

						<td class="text-left" style="width: 20%">本期开票金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.billingAmount}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">本期扣款金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.deductMoney}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>

						<td class="text-left" style="width: 20%">本期拟付款(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.amountPaid}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">上期未结金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.prPeriodAccountopen}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>

						<td class="text-left" style="width: 20%">本期实付款(元):</td>
						<td style="width: 30%"><fmt:formatNumber
								value="${stmPrepaid.quasiPayment}" pattern="##.##"
								minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
					<tr>
						<td class="text-left" style="width: 20%">会员卡折让金额(元):</td>
						<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.vipDiscount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div>
			<h4>扣款明细</h4>
			<table
				class="table table-striped table-hover o-l-table table-bordered"
					id="table2"  style="font-size: 13.5px; text-align: center">
				<thead>
					<tr>
<!-- 					<th style="width: 200px">费用名称</th>
 -->					<th style="width: 80px">费用名称</th>
						<th style="width: 70px">应扣金额</th>
						<th style="width: 70px">实扣金额</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${paymentDetailList}" var="paymentDetail">
						<tr>
							<td>${paymentDetail.costName}</td>
							<td><fmt:formatNumber
									value="${paymentDetail.shouldDeductAmount}" pattern="##.##"
									minFractionDigits="2"></fmt:formatNumber></td>
							<td><fmt:formatNumber
									value="${paymentDetail.realDeductAmount}" pattern="##.##"
									minFractionDigits="2"></fmt:formatNumber></td>
							<td>${paymentDetail.auditingRemark}</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<div>
			<c:if test="${stmPrepaid.contractType!='Z400'}">
				<h4>采购/调价明细</h4>
			</c:if>
			<!-- (经销) -->

			<c:if test="${stmPrepaid.contractType=='Z400'}">
				<h4>销售明细</h4>
			</c:if>
			<!-- (代销) -->
			<table
				class="table table-striped table-hover o-l-table table-bordered"
					id="table3" style="font-size:13.5px; text-align: center">
				<thead>
					<tr>
						<th style="width:20%">事务类型</th>
						<th style="width:18%">收货凭证日期</th>
						<th style="width:10%">数量</th>
						<th style="width:10%">净价</th>
						<th style="width:10%">税额</th>
						<th style="width:16%">含税金额</th>
						<th style="width:16%">税率税码</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${billDetailList}" var="bizStatementBillDetail">
						<tr>
							<td><ossp:value dictType="TRANTYPE"
									key="${bizStatementBillDetail.type}"></ossp:value></td>
							<td><fmt:formatDate
									value="${bizStatementBillDetail.receiveDate}"
									pattern="yyyy-MM-dd " /></td>
							<td>${bizStatementBillDetail.quantity}</td>
							<td><fmt:formatNumber
									value="${bizStatementBillDetail.netPrice}" pattern="##.##"
									minFractionDigits="2"></fmt:formatNumber></td>
							<td><fmt:formatNumber value="${bizStatementBillDetail.tax}"
									pattern="##.##" minFractionDigits="2"></fmt:formatNumber></td>
							<td><fmt:formatNumber
									value="${bizStatementBillDetail.taxAmount}" pattern="##.##"
									minFractionDigits="2"></fmt:formatNumber></td>
							<td>${bizStatementBillDetail.taxCode}</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
		<!--endprint-->
		<div style="width: 75%" align="center">
			<button class="btn btn-default btn_5" onClick="doPrint();">
				打印</button>
			<button class="btn btn-default btn_5" onClick="window.close();">
				关闭</button>
		</div>
</body>
</html>